Variables (func. params)

Prev Next

Introduction

Variable are expressions which must refer directly to a variable. Any other forms of expressions such as constants, calculations, function calls, table references, etc, are forbidden and assert exceptions. However, variable members (in structures and __arrays_ are allowed). dim(), structure(), array() and protect() are common functions which utilize this variant of code pieces.

       var 1[] = my array;
       var 2[] = 'my array[]';

          array(  var 0[],   {hog, bat, pig} );
       // array(  var 1[][], {dog, cat, rat} );   // This one is wrong
          array( :var 2[],   {dog, cat, rat} );   // This one is OK
       
       echo( var 0[1] ); // bat
       echo( my array[1] ); // cat
bat
cat
Try it yourself: Open LAN_Features_Variables_[func_params].b4p in B4P_Examples.zip. Decompress before use.